package cn.com.connext.scrm.web.rest;

import cn.com.connext.scrm.domain.master.*;
import cn.com.connext.scrm.service.*;
import cn.com.connext.scrm.service.dto.JsonResult;
import cn.com.connext.scrm.web.rest.vm.ActivityModuleConfigAddVM;
import com.connext.common.web.rest.BaseResource;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.ZonedDateTime;

/**
 * 第三方调用接口
 */
@RestController
@RequestMapping("/api/buryingpointbaileys/")
public class BuryingPointBaileysResource extends BaseResource {
    private final Logger log = LoggerFactory.getLogger(BuryingPointBaileysResource.class);
    @Autowired
    private BuryingPointBaileysScanService scanService;
    @Autowired
    private BuryingPointBaileysAuthorService authorService;
    @Autowired
    private BuryingPointBaileysRecipeService recipeService;
    @Autowired
    private BuryingPointBaileysGoshopService goshopService;
    @Autowired
    private BuryingPointBaileysRecipeScanService recipeScanService;
    @Autowired
    private BuryingPointBaileysPrizeButtonClickService prizeButtonClickService;
    @Autowired
    private BuryingPointBaileysRegisterService registerService;

    public BuryingPointBaileysResource() {
        super("BuryingPointBaileys");
    }

    /**
     * 埋点--新增扫码用户信息"
     */
    @ApiOperation(value = "埋点--新增扫码用户信息", notes = "埋点--新增扫码用户信息")
    @PostMapping(value = "/saveScan")
    public JsonResult saveScan(@RequestBody BuryingPointBaileysScan entity ){
        log.info("用户unionId : {}",entity.getUnionId());
        entity.setCreateTime(ZonedDateTime.now());
        return  scanService.saveScan(entity);
    }
    /**
     * 埋点--新增授权用户信息
     */
    @ApiOperation(value = "埋点--新增授权用户信息", notes = "埋点--新增授权用户信息")
    @PostMapping(value = "/saveAuthor")
    public JsonResult saveAuthor(@RequestBody BuryingPointBaileysAuthor entity ){
        log.info("用户unionId : {}",entity.getUnionId());
        entity.setCreateTime(ZonedDateTime.now());
        return  authorService.saveAuthor(entity);
    }

    /**
     * 埋点--新增点击按钮跳转信息
     */
    @ApiOperation(value = "埋点--新增点击按钮跳转信息", notes = "埋点--新增点击按钮跳转信息")
    @PostMapping(value = "/saveRecipe")
    public JsonResult saveRecipe(@RequestBody BuryingPointBaileysRecipe entity ){
        log.info("用户unionId : {}",entity.getUnionId());
        entity.setCreateTime(ZonedDateTime.now());
        return  recipeService.saveRecipe(entity);
    }

    /**
     * 埋点--新增跳转商城信息
     */
    @ApiOperation(value = "埋点--新增跳转商城信息", notes = "埋点--新增跳转商城信息")
    @PostMapping(value = "/saveRecipeGoshop")
    public JsonResult saveRecipeGoshop(@RequestBody BuryingPointBaileysRecipeGoshop entity ){
        log.info("用户unionId : {}",entity.getUnionId());
        entity.setCreateTime(ZonedDateTime.now());
        return  goshopService.saveRecipeGoshop(entity);
    }

    /**
     * 埋点--新增用户注册会员信息
     */
    @ApiOperation(value = "埋点--新增用户注册会员信息", notes = "埋点--新增用户注册会员信息")
    @PostMapping(value = "/saveRegister")
    public JsonResult saveRegister(@RequestBody BuryingPointBaileysRegister entity ){
        log.info("用户unionId : {}",entity.getUnionId());
        entity.setCreateTime(ZonedDateTime.now());
        return  registerService.saveRegister(entity);
    }

    /**
     * 埋点--新增浏览recipe页面
     */
    @ApiOperation(value = "埋点--新增浏览recipe页面", notes = "埋点--新增浏览recipe页面")
    @PostMapping(value = "/saveRecipeScan")
    public JsonResult saveRecipeScan(@RequestBody BuryingPointBaileysRecipeScan entity ){
        log.info("用户unionId : {}",entity.getUnionId());
        entity.setCreateTime(ZonedDateTime.now());
        return  recipeScanService.saveRecipeScan(entity);
    }

    /**
     * 埋点--抽奖按钮点击
     */
    @ApiOperation(value = "埋点--抽奖按钮点击", notes = "埋点--抽奖按钮点击")
    @PostMapping(value = "/savePrizeButtonClick")
    public JsonResult savePrizeButtonClick(@RequestBody BuryingPointBaileysPrizeButtonClick entity ){
        log.info("用户unionId : {}",entity.getUnionId());
        entity.setCreateTime(ZonedDateTime.now());
        return  prizeButtonClickService.savePrizeButtonClick(entity);
    }





}

